import React, { Component, Suspense, lazy } from 'react';
import { BrowserRouter, Route, Switch } from 'react-router-dom';

// const Login = lazy(() => import('../layout/Login'));
const BaseLayout = lazy(() => import('../layout/BaseLayout'));
const basename = process.env.PUBLIC_URL;
const supportsHistory = 'pushState' in window.history;

export default class MainRoute extends Component {
    render() {
        return (
            <Suspense fallback={null}>
                <BrowserRouter
                    forceRefresh={!supportsHistory}
                    basename={basename}
                >
                    <Switch>
                        {/* <Route path="/login" render={() => <Login />} /> */}
                        <Route
                            path="/"
                            render={() => <BaseLayout collapsed={false} />}
                        />
                    </Switch>
                </BrowserRouter>
            </Suspense>
        );
    }
}
